#ifndef T1_TIMER_H_
#define T1_TIMER_H_

#include "iodef.h"

typedef struct {
        __IO uint32_t TIM_LOAD;
        __IO uint32_t TIM_VAL;
        __IO uint32_t TIM_CTL;
        __IO uint32_t TIM_CLR;
        __IO uint32_t TIM_RIS;
        __IO uint32_t TIM_MIS;
        __IO uint32_t TIM_BG;
        __IO uint32_t Reserved;
}timer_reg_t;

/* TIM_CTL */
#define TIM_EN          _BIT(7)
#define TIM_PERIODIC    _BIT(6)
#define TIMI_EN         _BIT(5)

#define TIM_PRE_MSK     _MASK(2, 2)
#define TIM_PRE_1       _VALUE(2, 0x0)
#define TIM_PRE_16      _VALUE(2, 0x1)
#define TIM_PRE_256     _VALUE(2, 0x2)
#define TIM_32BIT_EN    _BIT(1)
#define TIM_ONESHOT     _BIT(0)

/* TIM_CLR, TIM_RIS, TIM_MIS */
#define TIM_INT         _BIT(0)

#endif /* T1_TIMER_H_ */
